﻿Partial Public Class SampleExplorer

    Public Const UsageBackgroundEmpty As Integer = 16777215
    Private WithEvents IMRevision_LookupEdit As GridLookUpEdit
    Public IMRevision_LookupView As GridView = Nothing
    Public LotSerialNo As String



    Public Enum ResultColor As Integer 'TODO read value from ResultFlags
        ValidEqual = 16564000
        GreaterThanTolerance = 16741680
        LowerThanTolerance = 16570000
        GreaterThanRejection = -65960
        LowerThanRejection = 16711935
        BooleanPass = 65280
        BooleanReject = 255
    End Enum


    Public Overridable Sub SampleDetail_MasterRowCellStyle(sender As Object, e As RowCellStyleEventArgs)
        Dim aView As GridView = DirectCast(sender, GridView)
        Dim aRow As System.Data.DataRow = aView.GetDataRow(e.RowHandle)

        If aRow IsNot Nothing Then
            SetResultBackcolorForecolor(aRow, e)
        End If

    End Sub

    Public Overridable Sub SampleDetail_MasterRowStyle(ByVal sender As Object, ByVal e As RowStyleEventArgs)
        Dim aView As GridView = DirectCast(sender, GridView)
        Dim aRow As System.Data.DataRow = aView.GetDataRow(e.RowHandle)

        SetBackgroudColor(aRow, e)

    End Sub

    Public Overridable Sub SampleDetail_ProcessCurrentMasterRecord(ByVal sender As Object, e As Views.Base.ValidateRowEventArgs)
        Dim aView As GridView = DirectCast(sender, GridView)
        Dim aRow As System.Data.DataRow = aView.GetDataRow(e.RowHandle)

        If e.RowHandle >= 0 Then
            ProcessResult(aRow)
        End If

    End Sub


    ''' <summary>
    ''' This Sub will scope the ItemMasterSpecification LOV, depending on the parent row column ItemMasterRevID_FK
    ''' </summary>
    ''' <remarks></remarks>
    Public Overridable Sub SampleDetail_ShownDetailEditor(sender As Object, e As System.EventArgs)
        Dim detailView As GridView = DirectCast(sender, GridView)
        'Dim aRow As System.Data.DataRow = detailView.GetFocusedDataRow()

        'If aRow IsNot Nothing AndAlso aRow.Table.TableName.Equals("SampleDetail") Then

        'End If

        If detailView.FocusedColumn.FieldName = "ItemMasterSpecID_FK" Then
            Dim parentView As GridView = CType(detailView.ParentView, GridView)
            Dim SampleHeaderRow As DataRow = parentView.GetFocusedDataRow()

            If TypeOf detailView.ActiveEditor Is GridLookUpEdit Then
                IMRevision_LookupEdit = CType(detailView.ActiveEditor, GridLookUpEdit)

                Dim ItemMasterRevID As Guid = If(IsDBNull(SampleHeaderRow("ItemMasterRevID_FK")), Guid.Empty, CType(SampleHeaderRow("ItemMasterRevID_FK"), Guid))

                LotSerialNo = SampleHeaderRow("LotSerialNo").ToString()
                'QAQCInspLotID_FK = CType(parentRow("QAQCInspLotID"), Guid)

                If detailView.FocusedColumn.FieldName = "ItemMasterSpecID_FK" Then
                    IMRevision_LookupEdit.Properties.View.ActiveFilterString = String.Format("ItemMasterRevID = '{0}'", ItemMasterRevID)
                    IMRevision_LookupEdit.Properties.View.OptionsView.ShowFilterPanelMode = Views.Base.ShowFilterPanelMode.Never
                End If

            End If
        ElseIf detailView.FocusedColumn.FieldName = "SpecificationTestRevId_FK" Then
            Dim SampleDetailRow As DataRow = detailView.GetFocusedDataRow()
            Dim SpecificationID As Guid
            Dim SpecRevision As Integer

            If TypeOf detailView.ActiveEditor Is GridLookUpEdit Then
                Dim edit As GridLookUpEdit = CType(detailView.ActiveEditor, GridLookUpEdit)
                edit.Properties.View.ActiveFilterEnabled = False


                If SampleDetailRow Is Nothing Then
                    SpecificationID = Guid.Empty
                Else
                    SpecificationID = If(IsDBNull(SampleDetailRow("SpecID_FK")), Guid.Empty, CType(SampleDetailRow("SpecID_FK"), Guid))
                    SpecRevision = If(IsDBNull(SampleDetailRow("MaxSpecRevision")), 0, CInt(SampleDetailRow("MaxSpecRevision")))
                End If

                If Not detailView.FocusedRowHandle.Equals(GridControl.AutoFilterRowHandle) Then
                    edit.Properties.View.ActiveFilterString = String.Format("IsActivated = True and RevisionNumber = {0} and SpecificationId_FK = '{1}' ", SpecRevision, SpecificationID.ToString)
                    edit.Properties.View.OptionsView.ShowFilterPanelMode = Views.Base.ShowFilterPanelMode.Never
                End If
            End If

        End If
    End Sub

    ''' <summary>
    ''' This sub assign values to the current new row. Values are coming from the selected row of the lookupEdit.
    ''' </summary>
    ''' <remarks></remarks>
    Public Overridable Sub IMRevision_LookupEdit_CloseUp(sender As Object, e As DevExpress.XtraEditors.Controls.CloseUpEventArgs) Handles IMRevision_LookupEdit.CloseUp
        Dim alookup As GridLookUpEdit = DirectCast(sender, GridLookUpEdit)

        If alookup.Properties.ValueMember = "ItemMasterSpecID" Then
            IMRevision_LookupView = alookup.Properties.View
        End If
    End Sub

    Public Overridable Sub SampleDetail_DetailRowCellStyle(sender As Object, e As RowCellStyleEventArgs)
        Dim aView As GridView = DirectCast(sender, GridView)
        Dim aRow As System.Data.DataRow = aView.GetDataRow(e.RowHandle)

        If aRow IsNot Nothing AndAlso aRow.Table.TableName.Equals("SampleDetail") Then
            SetResultBackcolorForecolor(aRow, e)

            'If e.RowHandle >= 0 Then
            '    InitResultValidation(e, aRow)
            'End If
        End If
    End Sub

    Public Overridable Sub SampleDetail_DetailRowStyle(ByVal sender As Object, ByVal e As RowStyleEventArgs)
        Dim aView As GridView = DirectCast(sender, GridView)
        Dim aRow As System.Data.DataRow = aView.GetDataRow(e.RowHandle)

        If aRow IsNot Nothing AndAlso aRow.Table.TableName.Equals("SampleDetail") Then
            SetBackgroudColor(aRow, e)
        End If

    End Sub

    Public Overridable Sub SampleDetail_ProcessCurrentDetailRecord(ByVal sender As Object, e As Views.Base.ValidateRowEventArgs, ByVal index As Integer)
        Dim aView As GridView = DirectCast(sender, GridView)
        Dim aRow As System.Data.DataRow = aView.GetDataRow(e.RowHandle)


        If aRow IsNot Nothing AndAlso aRow.Table.TableName.Equals("SampleDetail") Then

            If e.RowHandle >= 0 Then
                aRow("UserID_FK") = AppManager.UserID
                ProcessResult(aRow)
            Else
                If (IMRevision_LookupView IsNot Nothing) Then
                    aRow("LotSerialNo") = LotSerialNo
                    aRow("RepetNmbr") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "Repetition")
                    aRow("Target") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "Target")
                    aRow("Minimum") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "Minimum")
                    aRow("Maximum") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "Maximum")
                    aRow("SpecDetDescrFr") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "SpecDescr_ALT")
                    aRow("SpecDetDescrEng") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "SpecDescr_PRM")
                    aRow("SpecID_FK") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "SpecID")
                    aRow("NumBinSub") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "NumBinSub")
                    aRow("SOP") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "SOP")
                    aRow("Method") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "Method")
                    aRow("Dt_Utilisation") = Date.Today
                    aRow("Tm_Utilisation") = Date.Today
                    aRow("UnitId_FK") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "UnitID_FK")
                    aRow("TNTC") = 0
                    aRow("Valid") = 0
                    aRow("SampleNo") = LotSerialNo
                    aRow("CompulsoryRep") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "CompulsaryRep")
                    aRow("UsgBackground") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "BackgroundColor")
                    aRow("WipStat") = "W"
                    aRow("QAStat") = "O"
                    aRow("Reject") = 0
                    aRow("ResultDisplay") = 0
                    aRow("WipStatID_FK") = IdRepository.SAMPLE_DETAIL_WIPSTATUS_W
                    aRow("QAStatID_FK") = IdRepository.SAMPLE_DETAIL_QASTATUS_O
                    'aRow("ResultValidationID_FK") = IMRevision_LookupView.GetRowCellValue(IMRevision_LookupView.FocusedRowHandle, "ResultValidationID_FK")
                    aRow("Crtd_DT") = Date.Today
                    aRow("Crtd_UId") = AppManager.UserName
                    IMRevision_LookupView = Nothing
                End If
            End If
        End If


    End Sub


    Public Overridable Sub SampleDetail_DetailCustomRowCellEditForEditing(ByVal sender As Object, ByVal e As CustomRowCellEditEventArgs)
        Dim aDetailview As GridView = DirectCast(sender, GridView)
        Dim aRow As DataRow = aDetailview.GetFocusedDataRow()

        If e.Column.FieldName = "ItemMasterSpecID_FK" Then
            Dim parentView As GridView = CType(aDetailview.ParentView, GridView)
            Dim SampleHeaderRow As DataRow = parentView.GetFocusedDataRow()

            'On filtre pas si c'est la ligre de recherche
            If Not aDetailview.FocusedRowHandle.Equals(GridControl.AutoFilterRowHandle) Then
                Dim aEdit As RepositoryItemGridLookUpEdit
                Dim ItemMasterSpecID As Guid
                Dim sqlWhere As String

                If aRow IsNot Nothing AndAlso Not IsDBNull(aRow("ItemMasterSpecID")) Then
                    ItemMasterSpecID = If(IsDBNull(aRow), Guid.Empty, CType(aRow("ItemMasterSpecID"), Guid))
                Else
                    ItemMasterSpecID = Guid.Empty
                End If

                'Ici il faut reprendre le ItemMasterSpecID et le RoutingStep a partir du SampleHeaderRow et construire le SQLWhere
                ' Dim aGuid = If(IsDBNull(aRow), Guid.Empty, CType(SampleHeaderRow("ItemMasterSpecID"), Guid))
                Dim routingStep As Integer = If(IsDBNull(aRow), Guid.Empty, CInt(SampleHeaderRow("RoutingStep")))

                sqlWhere = String.Format("SpecGroupID_FK = '{0}' and ItemMasterSpecID = '{1}' and RoutingStep = {2}", IdRepository.APP_SPECIFGROUP_QLTY, ItemMasterSpecID, routingStep)
                aEdit = LOVBuilder("LOV_IMSRevisionDetail", sqlWhere, Nothing, Nothing)
                aEdit.Name = "LOV_IMSRevisionDetail"
                aDetailview.GridControl.RepositoryItems.Add(aEdit)
                e.RepositoryItem = aEdit
            End If
        End If
    End Sub

    Public Overridable Sub SampleDetail_DetailRowClick(ByVal sender As Object, ByVal e As RowClickEventArgs)
        Dim aView As GridView = DirectCast(sender, GridView)
        Dim aRow As System.Data.DataRow = aView.GetDataRow(e.RowHandle)

        If aRow IsNot Nothing AndAlso aRow.Table.TableName.Equals("SampleDetail") Then
            SetResultValidation(aRow, aView)
        End If
    End Sub

    Public Overridable Sub SetResultValidation(ByVal aRow As DataRow, ByVal aView As GridView)

        If Not String.IsNullOrEmpty(aRow("ResultValidationID_FK").ToString) Then
            Dim resultValidationID_FK As Guid = CType(aRow("ResultValidationID_FK"), Guid)

            If Not IsDBNull(resultValidationID_FK) AndAlso resultValidationID_FK = IdRepository.APP_VALIDATE_RESULT_RES Then
                'Colonne Result
                aView.Columns("Result").OptionsColumn.AllowEdit = True
                aView.Columns("Valid").OptionsColumn.AllowEdit = False
                aView.Columns("Comment").OptionsColumn.AllowEdit = False
            ElseIf Not IsDBNull(resultValidationID_FK) AndAlso resultValidationID_FK = IdRepository.APP_VALIDATE_RESULT_VAL Then
                'Colonne Valid
                aView.Columns("Valid").OptionsColumn.AllowEdit = True
                aView.Columns("Result").OptionsColumn.AllowEdit = False
                aView.Columns("Comment").OptionsColumn.AllowEdit = False
            ElseIf Not IsDBNull(resultValidationID_FK) AndAlso resultValidationID_FK = IdRepository.APP_VALIDATE_RESULT_CMT Then
                'Colonne Comment
                aView.Columns("Comment").OptionsColumn.AllowEdit = True
                aView.Columns("Result").OptionsColumn.AllowEdit = False
                aView.Columns("Valid").OptionsColumn.AllowEdit = False
            End If
        End If
    End Sub


    Public Overridable Sub InitResultValidation(ByVal e As RowCellStyleEventArgs, ByVal aRow As DataRow)

        If e.Column.Name.Contains("Comment") Then
            If e.Column.ColumnEdit Is Nothing And CType(aRow("ResultValidationID_FK"), Guid) = IdRepository.APP_VALIDATE_RESULT_CMT Then
                Dim aQueryName As String = "LOV_SpecificationValues"
                Dim mqEntries As MetaQuery = MetaQuery.GetMetaQueryByName(aQueryName)
                mqEntries.SQLWhere = String.Format("SpecID_FK = '{0}'", aRow("SpecID_FK").ToString)
                mqEntries.FillResultQuery()

                Dim aLOV As RepositoryItemGridLookUpEdit = New RepositoryItemGridLookUpEdit() With {.DataSource = mqEntries.ResultQuery, .DisplayMember = mqEntries.ResultQuery.Columns(CommonExt.Base.AppManager.ApplicationOption.DescriptionColumnIndex).ToString, .ValueMember = "SpecValueDescr_ALT", .PopupFormSize = New Size(800, 300), .NullText = "(none)"}
                aLOV.View.HorzScrollVisibility = Views.Base.ScrollVisibility.Always
                aLOV.View.OptionsView.ColumnAutoWidth = False
                aLOV.View.OptionsView.ShowAutoFilterRow = True
                aLOV.View.OptionsBehavior.ReadOnly = True

                e.Column.ColumnEdit = aLOV
                e.Column.ColumnEditName = aQueryName
            End If
        ElseIf e.Column.Name.Contains("Comment") Then
            If CType(aRow("ResultValidationID_FK"), Guid) = IdRepository.APP_VALIDATE_RESULT_VAL Then



            End If
        End If


    End Sub



    ''' <summary>
    ''' This sub sets RsltFlgColor, Valid and WipStat based on current Test Result
    ''' </summary>
    ''' <param name="aRow"></param>
    ''' <remarks></remarks>
    Public Overridable Sub ProcessResult(ByVal aRow As DataRow)
        If aRow IsNot Nothing AndAlso Not String.IsNullOrEmpty(aRow("ResultValidationID_FK").ToString) Then
            '
            Dim resultValidationID_FK As Guid = CType(aRow("ResultValidationID_FK"), Guid)
            '
            If Not IsDBNull(resultValidationID_FK) AndAlso resultValidationID_FK = IdRepository.APP_VALIDATE_RESULT_RES Then
                'Colonne Result
                ValidateColumnResult(aRow)
            ElseIf Not IsDBNull(resultValidationID_FK) AndAlso resultValidationID_FK = IdRepository.APP_VALIDATE_RESULT_VAL Then
                'Colonne Valid
                ValidateColumnValid(aRow)
            ElseIf Not IsDBNull(resultValidationID_FK) AndAlso resultValidationID_FK = IdRepository.APP_VALIDATE_RESULT_CMT Then
                'Colonne Comment
                ValidateColumnComment(aRow)
            End If
        End If
    End Sub


    ''' <summary>
    ''' This sub sets column Result backcolor and forecolor 
    ''' </summary>
    ''' <param name="aRow"></param>
    ''' <remarks></remarks>
    Public Overridable Sub SetResultBackcolorForecolor(ByVal aRow As DataRow, e As RowCellStyleEventArgs)
        If Not IsDBNull(aRow("RsltFlgColor")) Then
            Dim RsltFlgColor As Decimal = CType(aRow("RsltFlgColor"), Decimal)

            If e.RowHandle >= 0 Then
                If e.Column.FieldName = "Result" AndAlso Not IsDBNull(RsltFlgColor) AndAlso RsltFlgColor <> UsageBackgroundEmpty Then
                    e.Appearance.BackColor = ColorTranslator.FromOle(CInt(Math.Abs(RsltFlgColor)))
                    'Set forecolor black
                    If RsltFlgColor > 0 Then
                        e.Appearance.ForeColor = Color.Black
                    Else
                        e.Appearance.ForeColor = Color.White
                    End If
                End If
            End If
        End If
    End Sub


    Public Overridable Sub ValidateColumnResult(ByVal aRow As DataRow)

        If IsNumeric(aRow("Result")) Then
            Dim result As Single? = CType(aRow("Result"), Single?)
            Dim min As Decimal?
            Dim max As Decimal?

            aRow("LUpd_DT") = Date.Now()
            aRow("LUpd_UId") = AppManager.UserName

            If (String.IsNullOrEmpty(aRow("Minimum").ToString())) Then
                min = Nothing
            Else
                min = CType(aRow("Minimum"), Decimal?)
            End If

            If (String.IsNullOrEmpty(aRow("Maximum").ToString())) Then
                max = Nothing
            Else
                max = CType(aRow("Maximum"), Decimal?)
            End If


            If max.HasValue AndAlso max < result Then
                aRow("RsltFlgColor") = ResultColor.GreaterThanRejection
                aRow("Valid") = 0
                aRow("WipStatID_FK") = IdRepository.SAMPLE_DETAIL_WIPSTATUS_V
                aRow("WIPStat") = "V"
            ElseIf min.HasValue AndAlso result < min Then
                aRow("RsltFlgColor") = ResultColor.LowerThanRejection
                aRow("Valid") = 0
                aRow("WipStatID_FK") = IdRepository.SAMPLE_DETAIL_WIPSTATUS_V
                aRow("WIPStat") = "V"
            ElseIf max.HasValue And min.HasValue Then
                aRow("RsltFlgColor") = ResultColor.ValidEqual
                aRow("Valid") = 1
                aRow("WipStatID_FK") = IdRepository.SAMPLE_DETAIL_WIPSTATUS_C
                aRow("WIPStat") = "C"
            Else
                aRow("RsltFlgColor") = UsageBackgroundEmpty
                aRow("Valid") = 0
                aRow("WipStatID_FK") = IdRepository.SAMPLE_DETAIL_WIPSTATUS_W
                aRow("WIPStat") = "W"
            End If

        Else
            aRow("RsltFlgColor") = UsageBackgroundEmpty
            aRow("Valid") = 0
            aRow("WipStatID_FK") = IdRepository.SAMPLE_DETAIL_WIPSTATUS_W
            aRow("WIPStat") = "W"

        End If

    End Sub

    Public Overridable Sub ValidateColumnValid(ByVal aRow As DataRow)
        If aRow IsNot Nothing Then
            If CBool(aRow("Valid")) Then
                aRow("Valid") = 1
                aRow("WipStatID_FK") = IdRepository.SAMPLE_DETAIL_WIPSTATUS_C
                aRow("WIPStat") = "C"
            Else
                aRow("Valid") = 0
                aRow("WipStatID_FK") = IdRepository.SAMPLE_DETAIL_WIPSTATUS_W
                aRow("WIPStat") = "W"
            End If
        End If
    End Sub

    Public Overridable Sub ValidateColumnComment(ByVal aRow As DataRow)
        If aRow IsNot Nothing Then
            If Not String.IsNullOrEmpty(aRow("Comment").ToString) Then
                aRow("Valid") = 1
                aRow("WipStatID_FK") = IdRepository.SAMPLE_DETAIL_WIPSTATUS_C
                aRow("WIPStat") = "C"
            Else
                aRow("Valid") = 0
                aRow("WipStatID_FK") = IdRepository.SAMPLE_DETAIL_WIPSTATUS_W
                aRow("WIPStat") = "W"
            End If
        End If
    End Sub



    ''' <summary>
    ''' This sub sets row background color base on UsgBackground value 
    ''' </summary>
    ''' <param name="aRow"></param>
    ''' <remarks></remarks>
    Public Overridable Sub SetBackgroudColor(ByVal aRow As DataRow, e As RowStyleEventArgs)
        If aRow IsNot Nothing AndAlso Not IsDBNull(aRow("UsgBackground")) Then
            If CType(aRow("UsgBackground"), Decimal) = 0 Then
                e.Appearance.BackColor = ColorTranslator.FromOle(UsageBackgroundEmpty)
            Else
                e.Appearance.BackColor = ColorTranslator.FromOle(CInt(Math.Abs(CType(aRow("UsgBackground"), Decimal))))
            End If

        End If
    End Sub



    Public Overridable Sub CheckDecimalSeparator(ByVal value As Integer)
        'If Not IsNumeric(value) Then
        '    If IsNumeric(Replace(column.Value, CST_NumericFormat_Comma, CST_NumericFormat_Dot)) Then
        '        column.Value = Replace(column.Value, CST_NumericFormat_Comma, CST_NumericFormat_Dot)
        '    ElseIf IsNumeric(Replace(column.Value, CST_NumericFormat_Dot, CST_NumericFormat_Comma)) Then
        '        column.Value = Replace(column.Value, CST_NumericFormat_Dot, CST_NumericFormat_Comma)
        '        'End If
        '    End If
        'End If
    End Sub

    Public Overridable Sub PrintResult(ByVal sender As System.Object, ByVal e As EventArgs)
        Dim mnuItem As DXMenuItem = CType(sender, DXMenuItem)
        Dim queryName As String = "QualitySheetReport"
        Dim reportName As String = "F9Print"


        If mnuItem IsNot Nothing Then
            Dim aRow As DataRow = CType(mnuItem.Tag, DataRow)

            Dim LotCD As String = CStr(IIf(IsDBNull(aRow("LotCD")), String.Empty, aRow("LotCD").ToString()))
            Dim LotRev As Integer = CInt(IIf(IsDBNull(aRow("LotRev")), String.Empty, aRow("LotRev").ToString()))
            Dim OperationCD As String = CStr(IIf(IsDBNull(aRow("OperationCD")), String.Empty, aRow("OperationCD").ToString()))


            Using mquery As MetaQuery = MetaQuery.GetMetaQueryByName("QualitySheetReport")
                If mquery IsNot Nothing Then
                    Using report As DevExpress.XtraReports.UI.XtraReport = SCIEF.ActiveFramework.CommonExt.RptNotification.GetReportFromDB(reportName)
                        If report IsNot Nothing Then

                            mquery.SQLWhere = mquery.SQLWhere + String.Format(" AND LotSeq = '{0}' AND LotRev = CONVERT(VARCHAR(2), {1}) AND OperationId = (SELECT OperationId FROM Operation WHERE OperationCd = '{2}')", LotCD, LotRev, OperationCD)

                            mquery.FillResultQuery()
                            report.DataSource = mquery.ResultQuery
                            report.ShowPreviewDialog()

                            'Dim aFrm As Form = New ReportPrintForm() With {.Text = "Print Invoice", .RptPrintingSystem = report.PrintingSystem}
                            'aFrm.Show()
                        Else
                            Console.WriteLine(String.Format("{0}, Not Found in Report Definition. Notification abord", reportName))
                        End If
                    End Using
                Else
                    Console.WriteLine(String.Format("{0}, Not Found in MetaCommand. Notification abord", queryName))
                End If
            End Using
        End If


    End Sub

    Public Overridable Sub SampleDetail_ValidateRow(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs)
        Dim row As DataRow = CType(e.Row, DataRowView).Row
        Using plSampleDetail As SystemBoxSDK.PL.MESSDK.SampleDetail_PL = New SystemBoxSDK.PL.MESSDK.SampleDetail_PL()
            plSampleDetail.ValidateRow(row)
        End Using
    End Sub

End Class
